package com.amoyt.project.domain.res;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.util.List;

/**
 * 封装分页查询结果
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class PageResult implements Serializable {

    private long total; //总记录数

    private List records; //当前页数据集合

    /**
     * 返回空结果
     * @return
     */
    public static  PageResult empty(){
        return new PageResult(0,null);
    }

    /**
     * 只返回数量，不返回数据
     * @return
     */
    public static  PageResult ReturnTotal(long total){
        return new PageResult(total,null);
    }
}